/*
 * Copyright (C) 2010-2012 Susanta Tewari
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package genomemap.netbeans.jobs1.ksa00;

import cef.command.Command;
import cef.command.ComputeLHoodWEstCommand;
import cef.command.listener.ComputeLHoodWEstPrintWriter;
import cef.pui.EventConstructionException;
import commons.nb.jobs.Job;
import commons.nb.jobs.properties.ComboPropertyImpl;
import genomemap.cef.pui.ComputeKSA00LHoodWEstEventImpl;
import genomemap.nb.jobs.properties.Propertys_Gen;

import java.util.Properties;

/**
 * @since 1.3.0
 * @version 1.3.0
 * @author Susanta Tewari
 * @history Created on Oct 28, 2012.
 */
public final class ComputeKSA00LHoodWEstJob extends Job<ComputeKSA00LHoodWEstEventImpl> {

    public ComputeKSA00LHoodWEstJob() {

        setName("lhood-w-est-KSA00");
        setDisplayName("LHood KSA00 with Estimator");
        setShortDescription("Computes log likelihood for model KSA00 using an estimator");


        // data
        addComboProperty(Propertys_Gen.BUILDER_DATA_KSA00Data());


        // ESTIMATOR
        addComboProperty(new ComboPropertyImpl(Propertys_Gen.ESTIMATORS_KSA00()));


        // attach listeners
        addCommandOutputListener(new ComputeLHoodWEstPrintWriter());
    }

    @Override
    protected ComputeKSA00LHoodWEstEventImpl createEvent() throws EventConstructionException {

        final Properties properties = getProperties();


        // lhood algo
        properties.setProperty("genomemap.builder.KSA00Lhood.implCode", "ksa00:1");

        return new ComputeKSA00LHoodWEstEventImpl(properties);
    }

    @Override
    protected Command createCommand(final ComputeKSA00LHoodWEstEventImpl event) {
        return new ComputeLHoodWEstCommand<>(event);
    }

    @Override
    public boolean isCancellable() {
        return true;
    }

    @Override
    public Class<ComputeKSA00LHoodWEstEventImpl> getEventImplType() {
        return ComputeKSA00LHoodWEstEventImpl.class;
    }
}
